// gcc `pkg-config --cflags --libs ecore ecore-evas edje` gurpstl9.c -o gurpstl9
#include <Ecore_Evas.h>
#include <Ecore.h>
#include <Edje.h>
#include <stdlib.h>
#include <stdio.h>

/* GLOBALS */
Ecore_Evas  *ee;
Evas        *evas;
Evas_Object *edje;

int
app_signal_exit(void *data, int type, void *event)
{
    printf("DEBUG: Exit called, shutting down\n");
    ecore_main_loop_quit();

    return 1;
}

int
main(int argv, char *argc[])
{
    ecore_init();
    ecore_evas_init();

    ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, app_signal_exit, NULL);

    ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 800, 480);
    ecore_evas_title_set(ee, "GURPS TL9");
    ecore_evas_borderless_set(ee, 0);
    //ecore_evas_shaped_set(ee, 0);
    ecore_evas_show(ee);

    evas = ecore_evas_get(ee);
    evas_font_path_append(evas, "/usr/share/edje/data/test/fonts/");

    edje_init();
    edje = edje_object_add(evas);
    edje_object_file_set(edje, "gurpstl9.edj", "main");
    evas_object_move(edje, 0, 0);

    evas_object_resize(edje, 800, 480);
    evas_object_show(edje);
    ecore_evas_resize(ee, 800, 480);
    ecore_evas_show(ee);

    // Setting interface values
    edje_object_part_text_set(edje, "charname_label", "The Face of Bold");
    edje_object_part_text_set(edje, "points_label", "220");
    edje_object_part_text_set(edje, "ST_value", "11");
    edje_object_part_text_set(edje, "DX_value", "9");
    edje_object_part_text_set(edje, "IQ_value", "10");
    edje_object_part_text_set(edje, "HT_value", "100");

    ecore_main_loop_begin();

    return 0;
}

